package com.sx.manage.controller.consumer.person;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.sx.common.util.NumberUtil;
import com.sx.manage.biz.consumer.info.IMNetworkPersonConsumerBiz;
import com.sx.manage.controller.base.MBaseController;
import com.sx.manage.service.consumer.MConsumerBankWebServiceImpl;
import com.sx.manage.service.consumer.MConsumerWebServiceImpl;
import com.sx.manage.service.consumer.MPersonConsumerInfoWebServiceImpl;
import com.sx.manage.servlet.ViewAndModel;
import com.sx.manage.util.FormPageConstants;
import com.sx.manage.util.FormPageUtil;
import com.sx.model.constants.MDataStatusType;
import com.sx.model.constants.MSystemConstants;
import com.sx.model.constants.type.bank.MOutCardType;
import com.sx.model.constants.type.consumer.MConsumerFundStatusType;
import com.sx.model.manage.mybatis.form.BaseForm;
import com.sx.model.manage.mybatis.form.consumer.MPersonalConsumerNetworkForm;
import com.sx.model.manage.mybatis.vo.consumer.MConsumerBankMapVO;
import com.sx.model.manage.mybatis.vo.consumer.MPersonalConsumerNetworkVO;
import com.sx.model.manage.mybatis.vo.consumer.MPersonalConsumerVO;
import com.sx.model.manage.mybatis.vo.consumer.MVerifOpenAccountVO;
import com.sx.model.manage.mybatis.vo.result.ResultBooleanVO;
import com.sx.model.manage.mybatis.vo.result.ResultListVO;
import com.sx.model.manage.mybatis.vo.result.ResultVerifyVO;

/**
 * 个人用户管理 控制层
 * 
 * @author zhenzhanlong
 *
 */
@Controller
@RequestMapping("/perConsumer")
@SuppressWarnings({ "rawtypes" })
public class MPersonConsumerInfoController extends MBaseController {

	private Logger _log = LoggerFactory.getLogger(this.getClass());

	// 个人用户信息
	@Resource(name = "mNetworkPersonConsumerBizImpl")
	private IMNetworkPersonConsumerBiz mNetworkPersonConsumerBizImpl;

	@Resource(name = "personConsumerInfoWebServiceImpl")
	private MPersonConsumerInfoWebServiceImpl personConsumerInfoWebServiceImpl;
	// 用户银行信息
	@Resource(name = "consumerBankWebServiceImpl")
	private MConsumerBankWebServiceImpl consumerBankWebServiceImpl;

	@Resource(name = "consumerWebServiceImpl")
	private MConsumerWebServiceImpl consumerWebServiceImpl;

	public IMNetworkPersonConsumerBiz getmNetworkPersonConsumerBizImpl() {
		return mNetworkPersonConsumerBizImpl;
	}

	public void setmNetworkPersonConsumerBizImpl(IMNetworkPersonConsumerBiz mNetworkPersonConsumerBizImpl) {
		this.mNetworkPersonConsumerBizImpl = mNetworkPersonConsumerBizImpl;
	}

	public MPersonConsumerInfoWebServiceImpl getPersonConsumerInfoWebServiceImpl() {
		return personConsumerInfoWebServiceImpl;
	}

	public void setPersonConsumerInfoWebServiceImpl(MPersonConsumerInfoWebServiceImpl personConsumerInfoWebServiceImpl) {
		this.personConsumerInfoWebServiceImpl = personConsumerInfoWebServiceImpl;
	}

	public MConsumerBankWebServiceImpl getConsumerBankWebServiceImpl() {
		return consumerBankWebServiceImpl;
	}

	public void setConsumerBankWebServiceImpl(MConsumerBankWebServiceImpl consumerBankWebServiceImpl) {
		this.consumerBankWebServiceImpl = consumerBankWebServiceImpl;
	}

	public MConsumerWebServiceImpl getConsumerWebServiceImpl() {
		return consumerWebServiceImpl;
	}

	public void setConsumerWebServiceImpl(MConsumerWebServiceImpl consumerWebServiceImpl) {
		this.consumerWebServiceImpl = consumerWebServiceImpl;
	}

	/**
	 * 跳转到 普通用户列表界面
	 */
	@RequestMapping(value = "individualConsumer")
	public ViewAndModel consumerview(BaseForm form) {
		_log.debug(" MPersonConsumerInfoController   方法  consumerview  调用");
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/personal/individualConsumer");
		// 界面展开 菜单栏使用
		model.addObject("current", "indConsumer");
		// 统计三种状态
		model.pageInit(form, MPersonalConsumerNetworkForm.class, FormPageConstants.CONSUMER_PAGE, this.loginConsumer());
		return model;
	}

	/** 获取用户分页信息 */
	@RequestMapping(value = "pageConsumer")
	@ResponseBody
	public ResultListVO<MPersonalConsumerVO> page(MPersonalConsumerNetworkForm form) {
		_log.debug(" MPersonConsumerInfoController   方法  page 调用");
		ResultListVO<MPersonalConsumerVO> result = mNetworkPersonConsumerBizImpl.get_consumer_page(form);
		FormPageUtil.resertPage(cache, form, FormPageConstants.CONSUMER_PAGE, this.loginConsumer());
		return result;
	}

	/**
	 * 跳转到添加界面
	 */
	@RequestMapping(value = "toConsumerAdd")
	public ViewAndModel toConsumerAdd() {
		_log.debug(" MPersonConsumerInfoController   方法  toConsumerAdd 调用");
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/personal/addIndividualConsumer");
		return this.personConsumerInfoWebServiceImpl.toConsumerAdd(model);
	}

	/**
	 * 跳转到添加界面
	 */
	@RequestMapping(value = "toConsumerAdd/bank/{id}")
	public ViewAndModel toConsumerAddBank(@PathVariable Long id) {
		_log.debug(" MPersonConsumerInfoController   方法  toConsumerAddBank 调用");
		return this.personConsumerInfoWebServiceImpl.toConsumerAddBank(this.createView(), id);
	}

	/**
	 * 跳转到添加界面
	 */
	@RequestMapping(value = "toCardNumAdd")
	public ViewAndModel toCardNumAdd(Long consumer_id) {
		_log.debug(" MPersonConsumerInfoController   方法  toConsumerAdd 调用");
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/personal/bank/addBank");

		return this.consumerBankWebServiceImpl.toCardNumAdd(model, consumer_id);
	}

	/**
	 * 跳转到编辑界面
	 */
	@RequestMapping(value = "toConsumerEdit")
	public ViewAndModel toConsumerEdit(MPersonalConsumerVO consumer) {
		_log.debug(" MPersonConsumerInfoController   方法 toConsumerEdit  调用");
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/personal/editIndividualConsumer");
		this.personConsumerInfoWebServiceImpl.toConsumerEdit(consumer, model);
		return model;
	}

	@RequestMapping(value = "uploadConsumer")
	@ResponseBody
	public ResultListVO uploadConsumer(@RequestParam(value = "files", required = false) MultipartFile file, String channel_type) {
		_log.debug(" MPersonConsumerInfoController   方法 uploadConsumer  调用");
		return personConsumerInfoWebServiceImpl.consumer_excel_import(file, this.loginConsumer(), channel_type);
	}

	/**
	 * 跳转到添加界面
	 */
	@RequestMapping(value = "toConsumerView")
	public ViewAndModel toView(MPersonalConsumerVO consumer) {
		_log.debug(" MPersonConsumerInfoController   方法 toView  调用");
		ViewAndModel model = new ViewAndModel(request, cache);
		model.setViewName("consumer/personal/viewIndividualConsumer");
		MPersonalConsumerVO consumerVO = mNetworkPersonConsumerBizImpl.get_consumer_byId_for_view(consumer.getId()).getObjVo();
		model.addObject("consumerVO", consumerVO);
		model.addObject("view", "toView");
		return model;
	}

	/**
	 * 保存用户信息
	 * 
	 * @param MPersonalConsumerVO
	 * @return
	 */
	@RequestMapping(value = "saveConsumer")
	@ResponseBody
	public ResultBooleanVO save(MPersonalConsumerNetworkForm form) {
		return this.personConsumerInfoWebServiceImpl.save(form, this.loginConsumer());
	}

	/**
	 * 删除永不信息
	 * 
	 * @param ConsumerVO
	 * @return
	 */
	@RequestMapping(value = "consumerDelete")
	@ResponseBody
	public ResultBooleanVO consumerDelete(Long id) {
		_log.debug(" MPersonConsumerInfoController   方法   consumerDelete 调用");
		ResultBooleanVO result = null;
		// 直接调用删除
		result = this.mNetworkPersonConsumerBizImpl.del_by_ids(new Long[] { id }, loginConsumer());

		return result;
	}

	/** 获取用户信息列表 */
	@RequestMapping(value = "consumerlist")
	@ResponseBody
	public ResultListVO list(MPersonalConsumerNetworkForm form) {
		_log.debug(" MPersonConsumerInfoController   方法 list  调用");
		return mNetworkPersonConsumerBizImpl.get_consumer_list(form);
	}

	/**
	 * 选择公司下拉列表
	 * 
	 * @return
	 * @throws ServletException
	 * @throws IOException
	 */
	@RequestMapping(value = "ajaxSerchConsumer")
	@ResponseBody
	public ResultListVO<MPersonalConsumerNetworkVO> ajaxSerch(HttpServletRequest request) {
		_log.debug(" MPersonConsumerInfoController   方法  ajaxSerch  调用");
		return personConsumerInfoWebServiceImpl.ajaxSerch(request.getQueryString());
	}

	/** 激活用户信息 **/
	@RequestMapping(value = "activateConsumer")
	@ResponseBody
	public ResultBooleanVO activate(Long[] consumer_ids) {
		_log.debug(" MPersonConsumerInfoController   方法 activate  调用");
		return consumerWebServiceImpl.consumersActivate(consumer_ids, loginConsumer());
	}

	/*** 启用用户信息 **/
	@RequestMapping(value = "enableConsumer")
	@ResponseBody
	public ResultBooleanVO enable(Long[] consumer_ids) {
		_log.debug(" MPersonConsumerInfoController   方法  enable  调用");
		return mNetworkPersonConsumerBizImpl.consumers_enable(consumer_ids, loginConsumer());
	}

	/*** 启用用户信息 **/
	@RequestMapping(value = "fundStatusConsumer/{fundStatus}")
	@ResponseBody
	public ResultBooleanVO fundStatus(Long[] consumer_ids, @PathVariable MConsumerFundStatusType fundStatus) {
		_log.debug(" MPersonConsumerInfoController   方法   fundStatus 调用");
		return mNetworkPersonConsumerBizImpl.update_fund_status(consumer_ids, fundStatus, loginConsumer());
	}

	/** 用户禁用 ***/
	@RequestMapping(value = "disableConsumer")
	@ResponseBody
	public ResultBooleanVO disable(Long[] consumer_ids) {
		_log.debug(" MPersonConsumerInfoController   方法 disable   调用");
		return mNetworkPersonConsumerBizImpl.consumers_disable(consumer_ids, loginConsumer());
	}

	/*** 获取用户唯一编码 **/
	@RequestMapping(value = "uniqueCodeConsumer")
	@ResponseBody
	public String uniqueCode() {
		_log.debug(" MPersonConsumerInfoController   方法 uniqueCode   调用");
		return mNetworkPersonConsumerBizImpl.unique_consumerCode(MSystemConstants.CONSUMER_PREFIX_PERSON);

	}

	/*** 去除用户与企业的关系 **/
	@RequestMapping(value = "removeConsumerRelation")
	@ResponseBody
	public String removeRelation(Long consumer_id) {
		_log.debug(" MPersonConsumerInfoController   方法  removeRelation 调用");
		mNetworkPersonConsumerBizImpl.consumer_and_companyRelation_remove(consumer_id, loginConsumer());
		return "true";
	}

	/**
	 * 用户自动提现设置
	 * 
	 * @param consumer_ids
	 * @param autoWithdraw
	 * @return
	 */
	@RequestMapping(value = "autoWithdrawConsumer")
	@ResponseBody
	public ResultBooleanVO autoWithdraw(Long[] consumer_ids, String autoWithdraw) {
		_log.debug(" MPersonConsumerInfoController   方法 autoWithdraw  调用");
		ResultBooleanVO result = null;
		result = this.mNetworkPersonConsumerBizImpl.consumer_autoWithdraw_edit(consumer_ids, autoWithdraw, loginConsumer());
		return result;
	}

	/** 获取用户分页信息 */
	@RequestMapping(value = "autoWithdrawPageConsumer")
	@ResponseBody
	public ResultListVO<MPersonalConsumerVO> autoWithdrawPage(MPersonalConsumerNetworkForm form) {
		_log.debug(" MPersonConsumerInfoController   方法 autoWithdrawPage  调用");
		return mNetworkPersonConsumerBizImpl.get_consumer_page(form);
	}

	/**
	 * 用户支付密码解锁
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "unlockConsumer")
	@ResponseBody
	public ResultBooleanVO updatePayStatus(Long consumer_id) {
		_log.debug(" MPersonConsumerInfoController   方法 updatePayStatus  调用");
		ResultBooleanVO result = null;
		result = this.mNetworkPersonConsumerBizImpl.edit_Pay_status(consumer_id, MDataStatusType.DATA_AVAILABLE, loginConsumer());
		return result;
	}

	/**
	 * 用户三要素信息验证(新的华夏接口)
	 * 
	 * @param consumer_id
	 * @return
	 */
	@RequestMapping(value = "threeElementsConsumer")
	@ResponseBody
	public ResultBooleanVO threeElements(Long[] consumer_ids) {
		_log.debug(" MPersonConsumerInfoController   方法 threeElements   调用");
		return personConsumerInfoWebServiceImpl.threeElements(consumer_ids, this.loginConsumer());
	}

	/** 用户三要素信息验证(新的华夏接口) */
	@RequestMapping(value = "threeElementsConsumer/byBankMapId/{consumer_id}/{bank_map_id}")
	@ResponseBody
	public ResultBooleanVO threeElementsByBankMapId(@PathVariable Long consumer_id, @PathVariable Long bank_map_id) {
		_log.debug(" threeElementsConsumer /byBankMapId  方法调用");
		return personConsumerInfoWebServiceImpl.threeElementsByBankMapId(consumer_id, bank_map_id);
	}

	/** 人工验证通过三要素验证 */
	@RequestMapping(value = "artificialKeyValidate")
	@ResponseBody
	public ResultBooleanVO artificialKeyValidate(Long[] consumer_ids) {
		_log.debug(" MPersonConsumerInfoController   方法  artificialKeyValidate  调用");
		ResultBooleanVO result = null;
		result = this.personConsumerInfoWebServiceImpl.artificial_key_validate(consumer_ids);
		return result;
	}

	/** 人工验证通过三要素验证 */
	@RequestMapping(value = "artificialKeyValidate/byBankMapId/{consumer_id}/{bank_map_id}")
	@ResponseBody
	public ResultBooleanVO artificialKeyValidate(@PathVariable Long consumer_id, @PathVariable Long bank_map_id) {
		_log.debug(" MPersonConsumerInfoController   方法  artificialKeyValidate  调用");
		ResultBooleanVO result = null;
		result = this.personConsumerInfoWebServiceImpl.artificial_key_validate(consumer_id, bank_map_id);
		return result;
	}

	/** 直通鉴权 */
	@RequestMapping(value = "directAuthentication")
	@ResponseBody
	public ResultBooleanVO directAuthentication(Long[] consumer_ids) {
		_log.debug("直通鉴权directAuthentication  调用");
		return this.personConsumerInfoWebServiceImpl.directAuthentication(consumer_ids);
	}

	/** 直通鉴权 */
	@RequestMapping(value = "directAuthentication/byBankMapId/{consumer_id}/{bank_map_id}")
	@ResponseBody
	public ResultBooleanVO directAuthentication(@PathVariable Long consumer_id, @PathVariable Long bank_map_id) {
		_log.debug("直通鉴权directAuthentication  调用");
		return this.personConsumerInfoWebServiceImpl.directAuthentication(consumer_id, bank_map_id);
	}

	/**
	 * 跳转到渠道切换界面
	 */
	@RequestMapping(value = "changeTypeView")
	public ViewAndModel changeTypeView(Long consumerId) {
		_log.debug(" 跳转到渠道切换界面");
		ViewAndModel model = new ViewAndModel(request, cache);
		consumerWebServiceImpl.changeTypeView(model, consumerId);
		return model;
	}

	/**
	 * 跳转到渠道切换界面
	 */
	@RequestMapping(value = "openAccountView")
	public ViewAndModel openAccountView(Long consumerId, String channelType) {
		_log.debug(" 跳转到渠道切换界面");
		ViewAndModel model = new ViewAndModel(request, cache);
		consumerWebServiceImpl.openAccountView(model, consumerId, channelType);
		return model;
	}

	/** 用户切换使用的渠道类型 **/
	@RequestMapping(value = "changeTradeMemCode")
	@ResponseBody
	public ResultBooleanVO changeTradeMemCode(Long consumer_id, String relation_num) {
		return consumerWebServiceImpl.changeTradeMemCode(consumer_id, relation_num);
	}

	/**
	 * 子账户开户（华夏二代接口开户）
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(value = "openConsumerAccountsHuaxia02")
	@ResponseBody
	public ResultVerifyVO<MVerifOpenAccountVO> openConsumerAccountsHuaxia02(Long[] comIds) {
		_log.debug(" MPersonConsumerInfoController   方法   openConsumerAccounts 调用");
		return consumerWebServiceImpl.accountInfoHuaxia02(comIds);
	}

	/**
	 * 子账户开户（华夏二代接口开户）
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(value = "openConsumerAccountsHuaxia02/openAccountsNoCard")
	@ResponseBody
	public ResultVerifyVO<MVerifOpenAccountVO> openAccountsNoCard(Long[] comIds) {
		_log.debug(" MPersonConsumerInfoController   方法   openAccountsNoCard 调用");
		ResultVerifyVO<MVerifOpenAccountVO> result = consumerWebServiceImpl.openAccountsNoCard(comIds);
		if (!result.isSuccess()) {
			_log.info("注册用户开户失败error={}", result.getMsg());
			return result;
		}
		return result;
	}

	/**
	 * 绑定出入金卡
	 * 
	 * @param consumer_id
	 * @param bank_map_id
	 * @return
	 */
	@RequestMapping(value = "bindBankCard/{consumer_id}/{bank_map_id}")
	@ResponseBody
	public ResultBooleanVO bindBankCard(@PathVariable Long consumer_id, @PathVariable Long bank_map_id) {
		_log.debug(" MPersonConsumerInfoController   方法   openConsumerAccounts 调用");
		return consumerWebServiceImpl.bindBankCard(consumer_id, bank_map_id);
	}

	/**
	 * 绑定出金卡
	 * 
	 * @param consumer_id
	 * @param bank_map_id
	 * @return
	 */
	@RequestMapping(value = "bindBankOutCard/batch")
	@ResponseBody
	public ResultBooleanVO bindBatchBankOutCard(Long[] consumer_ids) {
		_log.debug(" bindBankOutCard   方法   openConsumerAccounts 调用");
		return consumerWebServiceImpl.bindBatchBankOutCard(consumer_ids);
	}

	/**
	 * 绑定出入金卡
	 * 
	 * @param consumer_id
	 * @param bank_map_id
	 * @return
	 */
	@RequestMapping(value = "bindBankCard/batch")
	@ResponseBody
	public ResultBooleanVO batchBindBankCard(Long[] consumer_ids) {
		_log.debug(" MPersonConsumerInfoController 方法 openConsumerAccounts 调用");
		return consumerWebServiceImpl.bindBatchBankCard(consumer_ids);
	}
	/**
	 * 绑定出金卡
	 * 
	 * @param consumer_id
	 * @param bank_map_id
	 * @return
	 */
	@RequestMapping(value = "bindBankOutCard/{consumer_id}/{bank_map_id}/{outCardType}")
	@ResponseBody
	public ResultBooleanVO bindBankOutCard(@PathVariable Long consumer_id, @PathVariable Long bank_map_id, @PathVariable MOutCardType outCardType) {
		_log.debug(" bindBankOutCard   方法   openConsumerAccounts 调用");
		return consumerWebServiceImpl.bindBankOutCard(consumer_id, outCardType, bank_map_id);
	}

	/**
	 * 解除出入金卡
	 * 
	 * @param consumer_id
	 * @param bank_map_id
	 * @return
	 */
	@RequestMapping(value = "relieveBankCard/{consumer_id}/{bank_map_id}")
	@ResponseBody
	public ResultBooleanVO relieveBankCard(@PathVariable Long consumer_id, @PathVariable Long bank_map_id) {
		_log.debug(" 解除出入金卡   方法   consumer_id={}", consumer_id);
		return consumerWebServiceImpl.relieveBankCard(consumer_id, bank_map_id, this.loginConsumer());
	}

	/**
	 * 子账户信息变更
	 * 
	 * @param consumer_id
	 * @return
	 */
	@RequestMapping(value = "accountInfoChange")
	@ResponseBody
	public ResultBooleanVO accountInfoChange(Long[] comIds) {
		_log.debug("子账户信息变更consumer_id={}", NumberUtil.arrayToStr(comIds));
		return consumerWebServiceImpl.accountInfoChangeBatch(comIds);
	}

	/**
	 * 子账户状态变更
	 * 
	 * @param consumer_id
	 * @return
	 */
	@RequestMapping(value = "accountStatusChange")
	@ResponseBody
	public ResultBooleanVO accountStatusChange(Long consumer_id, String tradeMemBerCode, String accountNo) {
		_log.debug("子账户信息变更consumer_id={},tradeMemBerCode", consumer_id, tradeMemBerCode);
		return consumerWebServiceImpl.accountStatusChange(consumer_id, tradeMemBerCode, accountNo);
	}

//	/**
//	 * 子账户信息查询
//	 * 
//	 * @param consumer_id
//	 * @return
//	 */
//	@RequestMapping(value = "getAccountInfo")
//	@ResponseBody
//	public B2BQueryAccountVO getAccountInfo(Long consumer_id) {
//		_log.debug("子账户信息变更consumer_id={}", consumer_id);
//		return consumerWebServiceImpl.getAccountInfo(consumer_id);
//	}

//	/**
//	 * 子账户绑定信息查询
//	 * 
//	 * @param consumer_id
//	 * @return
//	 */
//	@RequestMapping(value = "individualConsumer/getAccountBindInfo1")
//	@ResponseBody
//	public ViewAndModel getAccountBindInfo1(Long consumer_id, String outComeAccountType) {
//		_log.debug("子账户信息变更consumer_id={},outComeAccountType={}", consumer_id, outComeAccountType);
//		return consumerWebServiceImpl.getAccountBindInfo1(this.createView(), consumer_id, outComeAccountType);
//	}
//
//	/**
//	 * 子账户绑定信息查询
//	 * 
//	 * @param consumer_id
//	 * @return
//	 */
//	@RequestMapping(value = "individualConsumer/getAccountBindInfo")
//	@ResponseBody
//	public B2BBindBankCardResultVO getAccountBindInfo(Long consumer_id, String outComeAccountType) {
//		_log.debug("子账户信息变更consumer_id={},outComeAccountType={}", consumer_id, outComeAccountType);
//		return consumerWebServiceImpl.getAccountBindInfo(consumer_id, outComeAccountType);
//	}

//	/**
//	 * 子账户余额查询
//	 * 
//	 * @param consumer_id
//	 * @return
//	 */
//	@RequestMapping(value = "getAccountBalance")
//	@ResponseBody
//	public B2BAccountBalanceVO getAccountBalance(Long consumer_id, String accountTpye) {
//		_log.debug("子账户信息变更consumer_id={}", consumer_id);
//		return consumerWebServiceImpl.getAccountBalance(consumer_id);
//	}

//	/**
//	 * 子账户签约信息查询
//	 * 
//	 * @param consumer_id
//	 * @return
//	 */
//	@RequestMapping(value = "getContractAccountInfo")
//	@ResponseBody
//	public B2BAccountInfoVO getContractAccountInfo(Long consumer_id) {
//		_log.debug("子账户信息变更consumer_id={}", consumer_id);
//		return consumerWebServiceImpl.getContractAccountInfo(consumer_id);
//	}
//
//	/**
//	 * 解锁子账户
//	 * 
//	 * @param consumer_id
//	 * @return
//	 */
//	@RequestMapping(value = "toConsumerEdit/lockAccountNo")
//	@ResponseBody
//	public ResultBooleanVO lockAccountNo(Long consumer_id) {
//		_log.debug("锁定子账户信息consumer_id={}", consumer_id);
//		return consumerWebServiceImpl.lockAccountNo(consumer_id);
//	}
//
//	/**
//	 * 锁定子账户
//	 * 
//	 * @param consumer_id
//	 * @return
//	 */
//	@RequestMapping(value = "toConsumerEdit/unLockAccountNo")
//	@ResponseBody
//	public ResultBooleanVO unLockAccountNo(Long consumer_id) {
//		_log.debug("锁定子账户信息consumer_id={}", consumer_id);
//		return consumerWebServiceImpl.unLockAccountNo(consumer_id);
//	}

	/**
	 * 批量转账excel导出
	 * 
	 * @return HttpServletResponse response
	 * @throws IOException
	 */
	@ResponseBody
	@RequestMapping(value = "exportBatchTransfer")
	public void exportBatchTransfer(MPersonalConsumerNetworkForm form) throws IOException {
		_log.debug("批量转账excel导出form={}", form);
		consumerWebServiceImpl.exportBatchTransfer(form, response, this.loginConsumer());
	}

	/**
	 * accountNo excel导出
	 * 
	 * @return HttpServletResponse response
	 * @throws IOException
	 */
	@ResponseBody
	@RequestMapping(value = "exportBatchBankAccountNo")
	public void exportBatchBankAccountNo(MPersonalConsumerNetworkForm form) throws IOException {
		_log.debug("批量accountNo转账excel导出form={}", form);
		consumerWebServiceImpl.exportBatchBankAccountNo(form, response, this.loginConsumer());
	}

	/**
	 * 保存用户银行信息
	 * 
	 * @param MPersonalConsumerVO
	 * @return
	 */
	@RequestMapping(value = "saveConsumer/bank")
	@ResponseBody
	public ResultBooleanVO saveConsumerBank(MPersonalConsumerNetworkForm form) {
		_log.debug("保存用户银行信息form={}", form);
		return this.personConsumerInfoWebServiceImpl.saveConsumerBank(form, loginConsumer());
	}

	/**
	 * 绑定出入金卡界面跳转
	 * 
	 * @param consumer_id
	 * @param bank_map_id
	 * @return
	 */
	@RequestMapping(value = "bindBankCard/View/{consumer_id}")
	@ResponseBody
	public ViewAndModel bindBankCardView(@PathVariable Long consumer_id) {
		_log.debug(" MPersonConsumerInfoController   方法   openConsumerAccounts 调用");
		return personConsumerInfoWebServiceImpl.bindBankCardView(this.createView(), consumer_id);
	}

	/**
	 * 绑定出入金卡数据获取
	 * 
	 * @param consumer_id
	 * @param bank_map_id
	 * @return
	 */
	@RequestMapping(value = "bindBankCard/List")
	@ResponseBody
	public ResultListVO<MConsumerBankMapVO> bindBankCardList(Long consumer_id) {
		_log.debug(" MPersonConsumerInfoController   方法   openConsumerAccounts 调用");
		return personConsumerInfoWebServiceImpl.bindBankCardList(consumer_id);
	}

	/**
	 * 
	 * 设置银行卡为默认卡
	 * 
	 * @param MPersonalConsumerVO
	 * @return
	 */
	@RequestMapping(value = "/defaultCardNum/{consumer_id}/{bank_map_id}")
	@ResponseBody
	public ResultBooleanVO defaultCardNum(@PathVariable Long consumer_id, @PathVariable Long bank_map_id) {
		_log.debug("保存用户银行信息consumer_id={},bank_map_id={}", consumer_id, bank_map_id);
		return this.personConsumerInfoWebServiceImpl.defaultCardNum(consumer_id, bank_map_id);
	}
}
